﻿Imports System.Windows.Forms
Namespace form
    Public Class DialogBase

        Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Me.DialogResult = System.Windows.Forms.DialogResult.OK
            Me.Close()
        End Sub

        Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
            Me.Close()
        End Sub

        Protected Overrides Function ProcessDialogKey(ByVal keyData As System.Windows.Forms.Keys) As Boolean
            If keyData = Keys.Escape Then
                Me.Close()
            End If
            Return MyBase.ProcessDialogKey(keyData)
        End Function

    End Class

End Namespace